#include <stdio.h>
int main()
{
    int a[4][4];
    int i, j;
    for (i = 0; i <= 3; i++)
    {
        for (j = 0; j <= 3; j++)
        {
            scanf(" %d", &a[i][j]);
            printf("%d\n", a[i][j]);
        }
        printf("\n");
    }
    for (j = 0; j <= 3; j++)
    {
        for (i = 0; i <= 3; i++)
        {
            printf("%d", a[i][j]);
        }
        printf("\n");
    }
    return 0;
}